﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace TiebaSpider.Beans
{
    public class ImageInformation : INotifyPropertyChanged
    {
        private string thumbnailUrl;
        public string ID { get; private set; }
        public string Name { get; private set; }
        public string ThumbnailUrl
        {
            get { return thumbnailUrl; }
            set
            {
                thumbnailUrl = value;
                string[] picUrlUnit = thumbnailUrl.Split('/');
                Name = picUrlUnit[picUrlUnit.Length - 1];
                string[] picNameUnit = Name.Split('.');
                ID = picNameUnit[0];
                OnPropertyChanged(new PropertyChangedEventArgs("ThumbnailUrl"));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }
    }
}
